#include <stdio.h>
#include <math.h>

#define TRACE(x...)

double d, f;
double pd, pf;
double sf, sd;

void printRound(double a) {
	int trun = (int) a;

	if (a>=(double)(trun+0.5))
		printf("%d\n", trun+1);
	else printf("%d\n", trun);
}

int main() {
	scanf("%lf %lf", &d, &f);
	
	while (d!=-1.0 || f!=-1.0) {
		sf=0.0;
		sd=0.0;

		while (d!=0.0 || f!=0.0) {
			pd=d; pf=f;
			scanf("%lf %lf", &d, &f);

			if (d==0.0 && f==0.0) break;

			if (f<=pf) {
				sf+=(pf-f);
				sd+=(d-pd);
			}				
		}

		TRACE(printf("%lf %lf\n", sf, sd));
		printf("%d\n", (int) floor((sd*pf)/sf +0.5)); 
		scanf("%lf %lf", &d, &f);
	}
	return 0;
}
